package com.kaibes.admin.account;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import com.kaibes.web.admin.AdminController;
import com.kaibes.web.api.ApiLink;
import com.kaibes.web.util.ControllerUtils;

@AdminController
@RequestMapping("/admin/account")
public class AccountController {
    
    @GetMapping
    @ApiLink("账号管理")
    public String adminUser() {
        return "account";
    }
    
    @GetMapping("register")
    @ApiLink(value = "用户注册界面", validated = false)
    public String register() {
        return "register";
    }
    
    @GetMapping("reset")
    @ApiLink(value = "忘记密码找回", validated = false)
    public String forgotPassword(@RequestAttribute(required = false) Integer userId) {
        if (userId != null) {
            return ControllerUtils.redirect("/admin");
        }
        return "reset";
    }
    
}
